************************************
*"First stage": stuff for Section 2*
************************************
*
clear 
set more off
********************************
*Data preparation for 1st stage*
********************************
*
do $DIRDO/skewregs_dataprep1ststage.do
set linesize 250
*
********************************************
* Table 2: Demand Shocks and local exports *
********************************************
*
do $DIRDO/skewregs_tab2.do
*
*********************************************
* Table 3: Demand Shocks and local skewness *
*********************************************
*
use temp,clear
eststo clear
keep if nbnc8iso2>1
keep if nbnc8_max>1
global depvar = "theil"
global depvar_d1 = "theil_d1"
global nbnc8iso2 " "
global nbnc8iso2_d1 " "
*
save tempfirst,replace
*
do $DIRDO/skewregs_tab3.do
*
***********************************************************************************
* Tables 4 (and former 5): Skewness and Shocks - Robustness wrt Skewness measures *
***********************************************************************************
*
do $DIRDO/skewregs_tab4.do
*
*****************************************************************************
*Robustness of results in Tables 2 and 3 to firm-level worldwide trade shock*
*****************************************************************************
* GENERATES TABLE REFERED TO IN footnote 17
*
do $DIRDO/skewregs_tab_wwshockrob.do
*
*************************************************************************
*Robustness of results in Tables  3 to firm-level worldwide theil index *
*************************************************************************
* GENERATES TABLE REFERED TO IN footnote 19
*
do $DIRDO/skewregs_tab_wwtheilrob.do
*
********************************************
*Investigations with dest-isic-year effects* 
********************************************
*
do $DIRDO/skewregs_tab_destyearFErob.do
*
****************************************************************************
*
*************************************
*"Second stage": stuff for Section 5*
*************************************
*
do $DIRDO/skewregs_dataprep2ndstage.do
*
*************************************************************
*Correlation between the two calculations of the theil index*
*************************************************************
do $DIRDO/skewregs_fig3.do
*
********************************************************************
*Trade shock effects on exports and # of products + export intensity
********************************************************************
*
do $DIRDO/skewregs_tab5.do


******************
******************
**REDUCED FORM****
******************
******************
*
*******************************
*Reduced form of pty on shocks*
*******************************
*
do $DIRDO/skewregs_tab6.do


***********************************************
*Robustness checks mentionned but not in paper*
***********************************************
*
do $DIRDO/skewregs_tab6_robs.do
*
**********************
*Adding import shocks*
**********************
*
do $DIRDO/skewregs_C2.do

**********************************************
*Falsification: check for single product firms
**********************************************
*
do $DIRDO/skewregs_tab9.do
*

****************************
*Low/high  export intensity*
****************************
*
do $DIRDO/skewregs_tab10.do

***************
*Scale effects*
***************
*
do $DIRDO/skewregs_tab8.do


*************************************
*K/L does not respond to trade shock*
*************************************
*
do $DIRDO/skewregs_tab7.do
*

********
*Graphs*
********
*
*Graph top 1000 exporter's change in trade shock vs change in pty
*
do $DIRDO/skewregs_fig4.do



